package com.competition.jingdong;

import java.io.BufferedReader;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;

//sku
// ,SKU编码,长,宽,高,SKU是否可以变形

public class SkuCsvProcess{
    public void processing(Path toprocess, String charset, Map map) {
        try {
            BufferedReader br = Files.newBufferedReader(toprocess, Charset.forName(charset));
            String s = br.readLine();//处理标题栏
            s=br.readLine();
            while(s!=null)
            {
                String[] sArray = s.split(",");
                Integer skuNo = Integer.valueOf(sArray[1]);
                Integer length = Integer.valueOf(sArray[2]);
                Integer weight = Integer.valueOf(sArray[3]);
                Integer high = Integer.valueOf(sArray[4]);
                boolean change = Integer.valueOf(sArray[5])==1?true:false;
                Sku sku = new Sku(skuNo,length,weight,high,change);
                map.put(skuNo,sku);
                s=br.readLine();
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
